#include <stdio.h>
//
// Created by win10 on 2025/1/3.
//
int binarySearch(int arr[], int size, int key) {
    int low = 0;
    int high = size - 1;
    while (low <= high) {
        int mid = (low + high) / 2;
        if (arr[mid] == key) {
            return mid;
        }
        if (arr[mid] < key) {
            low = mid + 1;
        }else {
            high = mid - 1;
        }
    }
}
int main() {
    int n,m;
    scanf("%d%d",&n,&m);
    int arr[n];
    for(int i=0;i<n;i++) {
        scanf("%d",&arr[i]);
    }
    int targets[m];
    for(int i=0;i<m;i++) {
        scanf("%d",&targets[i]);
        int x = binarySearch(arr,n,targets[i]);
        printf("%d%s",x,i==m-1?"":" ");
    }

}